package com.example.cloudmusicserve.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @description: ImgConfig
 * @author: xiaoyuan
 * @time: 2023/5/27
 */
@Configuration
public class ImgConfig implements WebMvcConfigurer {
    @Value("${file.save.path}")
    String fileSavePath;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/images/**").
                addResourceLocations("file:"+fileSavePath);
    }
}


